<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://www.myfirefly.cn/tag/auth" prefix="auth"%>
<script type="text/javascript">
function upload_callback_tradeContract_claim(file, data) {
    var json = $.parseJSON(data);
    var html = $("#contract_upload_message").html();
	var _temp = "";
    if(json.statusCode == "200"){
	    _temp += "<span>";
		_temp += json.message;
		_temp += "</span>";
	    $("#contract_upload_message").html(html+_temp);
		//展示临时文件
		var $tr='<div style="display:inline-block;margin-right:10px;"><img src='+json.data[0].imgUrl+' alt="your image" width="100px" height="100px" /></div>';
	    $("#contract_upload_pic").html($("#contract_upload_pic").html()+$tr);
		var _show = "";
		_show+='<div class="attachment_box">';
		_show+='<a href="javascript:void(0);"  onclick="atlas(this)">';
		_show+='<div class="attachment_img">';
		_show+='<img src='+json.data[0].imgUrl+'>';
		_show+='</div>';
		_show+='</a>';
		_show+='<a href="javascript:void(0);" onclick="delContractAttachById('+json.data[0].id+', this);" class="btn btn-red delete"><i class="fa fa-remove"></i>删除</a>';
		_show+='</div>';
	    $("#contract_attachment").html($("#contract_attachment").html()+_show);
	    var indx = $("#uploadIndex").val();
	    indx = parseInt(indx) + 1;
	    $("#uploadIndex").val(indx+'');
	}else{
		_temp += "<span style='color:red;font-weight: bold;'>";
		_temp += json.message;
		_temp += "</span>";
	    $("#contract_upload_message").html(html+_temp);
	}
}

</script>

<div class="bjui-pageContent" id="contractAttachmentUpload">
	<div>
		<fieldset style="margin: 5px;font-size: 14px;font-weight: bold;">
			<legend>上传文件信息</legend>
			<input id="uploadIndex" type="hidden" value="${uploadIndex}">
			<auth:has funcId="spfTradeContractWebimage" action="/spfTradeContractWebimage/saveFileAndInsertInfo.do">
			<div style="display: inline-block; vertical-align: middle;height: 315px;overflow: auto;width: 880px;margin-left: 10px;">
				<div id="contract_upload_pic_up" 
				 	data-toggle="upload" 
				 	data-uploader="spfTradeContractWebimage/saveFileAndInsertInfo.do?contractId=${contractId}&uploadIndex={#uploadIndex}"
			        data-file-size-limit="10485760"
			        data-file-type-exts="*.jpg;*.png"
			        data-multi="true"
			        data-async="false"
   				    data-auto="true"
			        data-on-upload-success="upload_callback_tradeContract_claim"
			        data-icon="cloud-upload"></div>
			</div>
			</auth:has>
		</fieldset>
		<fieldset style="margin: 5px;font-size: 14px;font-weight: bold;">
			<legend>上传成功的图片</legend>
			<div id="contract_upload_pic" style="display: inline-block; vertical-align: middle;height: 115px;overflow: auto;width: 880px;padding: 0px 5px;font-size: 14px;line-height: 24px;font-weight: normal;">
				
			</div>
		</fieldset>
		<fieldset style="margin: 5px;font-size: 14px;font-weight: bold; display: none;">
			<legend>上传操作日志</legend>
			<div id="contract_upload_message" style="display: inline-block; vertical-align: middle;height: 115px;overflow: auto;width: 880px;padding: 0px 5px;font-size: 14px;line-height: 24px;font-weight: normal;"></div>
		</fieldset>
	</div>
</div>
<div class="bjui-pageFooter">
	<ul>
		<li><button type="button" class="btn btn-red cancel" data-icon="remove">关闭</button></li>
	</ul>
</div>